package com.ruoyi.system.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.GuestbookmubanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GuestbookMapper;
import com.ruoyi.system.service.IGuestbookService;
import com.ruoyi.common.core.text.Convert;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-23
 */
@Service
public class GuestbookServiceImpl implements IGuestbookService 
{
    @Autowired
    private GuestbookMapper guestbookMapper;

    @Autowired
    private GuestbookmubanMapper guestbookmubanMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param guestbookid 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public Guestbook selectGuestbookById(String guestbookid)
    {
        return guestbookMapper.selectGuestbookById(guestbookid);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param guestbook 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<Guestbook> selectGuestbookList(Guestbook guestbook)
    {
        return guestbookMapper.selectGuestbookList(guestbook);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param guestbook 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertGuestbook(Guestbook guestbook)
    {
        return guestbookMapper.insertGuestbook(guestbook);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param guestbook 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateGuestbook(Guestbook guestbook)
    {
        return guestbookMapper.updateGuestbook(guestbook);
    }

    /**
     * 删除【请填写功能名称】对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGuestbookByIds(String ids)
    {
        return guestbookMapper.deleteGuestbookByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param guestbookid 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteGuestbookById(String guestbookid)
    {
        return guestbookMapper.deleteGuestbookById(guestbookid);
    }


    // 查询留言板模板
    @Override
    public List<Guestbookmuban> selectCustomGuestbookList(Guestbookmuban guestbookmuban)
    {
        List<Guestbookmuban> mmList = new ArrayList<>();
        //  留言的查询使用like
        String  mmLiuyan = guestbookmuban.getLiuyan();
        if(mmLiuyan!=null&& !mmLiuyan.equals("")){
            mmLiuyan ="%"+mmLiuyan+"%";
            guestbookmuban.setLiuyan(mmLiuyan);
        }
        List<Guestbookmuban> mmCustomGuestbookListList = guestbookmubanMapper.selectCustomGuestbookmubanList(guestbookmuban);

        return mmCustomGuestbookListList;
    }

}
